﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Register.IDAL;
using Register.Model;
using Register.DALFactory;
using Register.Command;

namespace Register.BLL
{
    public class PatientUserInfoBLL
    {
        /// <summary>
        /// FileName: PatientUserInfo.cs
        /// CLRVersion: 4.0.30319.269
        /// Author: WangKungLun
        /// Corporation: 
        /// Description: 
        /// DateTime: 2012/7/7 10:07:20
        /// </summary>
        private static String typeNameKey = "IPatientUserInfoDALKey";

        public static bool UpdatePatientUserInfo(Model.Patient model)
       {
           IPatientUserInfoDAL iPatientUserInfo = DALFactory<IPatientUserInfoDAL>.Create(typeNameKey);
           try
           {
               if (iPatientUserInfo.UpdatePatientUserInfo(model) > 0)
               {
                   return true;
               }
               else
                   return false;
           }
           catch (Exception e)
           {
               LogRecordHelper.LogNote("ERROR", e.Message);
               throw e;
           }
       }

        public static List<Model.Patient> GetPagedPatientUserInfo(int size, int pageIndex, string where)
       {
           IPatientUserInfoDAL iPatientUserInfo = DALFactory<IPatientUserInfoDAL>.Create(typeNameKey);

           try
           {
               return iPatientUserInfo.GetPagedPatientUserInfo(size, pageIndex, where);
           }
           catch (Exception e)
           {
               LogRecordHelper.LogNote("ERROR", e.Message);
               throw e;
           }
       }

        public static Model.Patient GetPatientUserInfo(string PatientUserInfo_ID)
       {
           IPatientUserInfoDAL iPatientUserInfo = DALFactory<IPatientUserInfoDAL>.Create(typeNameKey);
           try
           {
               return iPatientUserInfo.GetPatientUserInfo(PatientUserInfo_ID);
           }
           catch (Exception e)
           {
               LogRecordHelper.LogNote("ERROR", e.Message);
               throw e;
           }
       }

        public static int GetPatientUserInfoCount(string where)
       {
           IPatientUserInfoDAL iPatientUserInfo = DALFactory<IPatientUserInfoDAL>.Create(typeNameKey);

           try
           {
               return iPatientUserInfo.GetPatientUserInfoCount(where);
           }
           catch (Exception e)
           {
               LogRecordHelper.LogNote("ERROR", e.Message);
               throw e;
           }
       }
    }
}
